import { useEffect, useState } from 'react'
import { start } from 'qiankun'
import Bread from '@/component/bread/bread'
import { useLocation } from 'react-router-dom'

const Writeqk = () => {
  const [bread, setBread] = useState(['博客', '博客写作'])
  const { pathname } = useLocation()
  useEffect(() => {
    console.log('write start')
    setTimeout(() => {
      // if (!(window as any).qiankunWriteStarted) {
      // ;(window as any).qiankunWriteStarted = true
      start()
      // }
    })
  }, [])
  useEffect(() => {
    if (pathname === '/index/writeQK') {
      setBread(['博客', '博客写作'])
    } else {
      setBread(['博客', '博客管理'])
    }
  }, [pathname])
  return (
    <>
      <Bread bread={bread}></Bread>
      <div id="container"></div>
    </>
  )
}

export default Writeqk
